package com.frank.twloading;

import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.aafwk.content.Operation;
import ohos.agp.components.Button;

public class MainAbility extends Ability {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        setUIContent(ResourceTable.Layout_ability_main);

        Button normalBtn = (Button) findComponentById(ResourceTable.Id_load_normal_btn);
        normalBtn.setClickedListener(component -> {
            Intent intent12 = new Intent();
            Intent.OperationBuilder builder = new Intent.OperationBuilder();
            Operation operation = builder.withAbilityName(NormalLoadAbility.class)
                    .withBundleName(getBundleName())
                    .build();
            intent12.setOperation(operation);
            startAbility(intent12);
        });
        Button specialBtn = (Button) findComponentById(ResourceTable.Id_load_special_btn);
        specialBtn.setClickedListener(component -> {
            Intent intent1 = new Intent();
            Intent.OperationBuilder builder = new Intent.OperationBuilder();
            Operation operation = builder.withAbilityName(SpecialLoadAbility.class)
                    .withBundleName(getBundleName())
                    .build();
            intent1.setOperation(operation);
            startAbility(intent1);
        });

    }

}
